import {moduleName} from "./a_moduleInfo";
import CrudCommon from "@/api/util/crudCommonController";


class CJS extends CrudCommon {
  constructor() {
    super({moduleName: moduleName, entityName: 'tichuDetail'}); //  调用父类的 constructor(x, y)
  }

  returnAllJjxMc(years) {
    return this.doRequest({
      url: this.baseUrl + '/returnAllJjxMc',
      method: 'get',
      params: {years: years}
    })
  }

  sumForResult(query) {
    return this.doRequest({
      url: this.baseUrl + '/sumForResult',
      method: 'post',
      data: query
    })
  }

  sumForResultRow(query) {
    return this.doRequest({
      url: this.baseUrl + '/sumForResultRow',
      method: 'post',
      params: query
    })
  }

  deleteAll(query) {
    return this.doRequest({
      url: this.baseUrl + '/deleteAll',
      method: 'delete',
      params: query
    })
  }

  changeStatusBatch(ids, status) {
    return this.doRequest({
      url: this.baseUrl + '/changeStatusBatch',
      method: 'post',
      params: {
        ids: ids, status: status
      }
    })
  }

  fetchAllFilenames(years, sourceType, rootDeptCode) {
    return this.doRequest({
      url: this.baseUrl + '/fetchAllFilenames',
      method: 'post',
      params: {
        years: years, sourceType: sourceType, rootDeptCode: rootDeptCode
      }
    })
  }

  removeByFileName(years, sourceType, rootDeptCode, type, fileName) {
    return this.doRequest({
      url: this.baseUrl + '/removeByFileName',
      method: 'delete',
      params: {
        years: years, sourceType: sourceType, rootDeptCode: rootDeptCode, type: type, fileName: fileName
      }
    })
  }

  /**
   * 获取数据，以config表中保存的职级为准
   * @param years
   * @param sourceType
   * @param rootDeptCode
   */
  importDataFromInterface(years, sourceType, rootDeptCode) {
    return this.doRequest({
      url: this.baseUrl + '/importDataFromInterface',
      method: 'post',
      params: {
        years: years, sourceType: sourceType, rootDeptCode: rootDeptCode
      }
    })
  }
}

export default new CJS();
